<template>
  <div class="breadcrumb">
    <!-- <el-breadcrumb separator="/">
      <el-breadcrumb-item v-for="v in lists" :key="v.path">
        <router-link :to="v.path">{{ v.meta.title }}</router-link>
      </el-breadcrumb-item>
    </el-breadcrumb> -->
    <div v-for="v in lists" :key="v.path">
      <router-link :to="v.path" style="color: #fff; font-size: 18px; font-weight: bolder;">{{ v.meta.title }}</router-link>
    </div>
  </div>
</template>

<script setup>
import {ref, onMounted,watch} from 'vue'
import {useRouter, useRoute} from 'vue-router'

//实例化路由信息
const route = useRoute(); 
const lists = ref([]);

//监听路由信息
watch(route,(newVal,oldVal) => {
  getBreadcrumb(newVal.matched);
})

onMounted(() => {
  getBreadcrumb(route.matched);
})

function getBreadcrumb(matched) {
  lists.value = matched; //获取路由信息
}

</script>